# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.BackupDR.V1.Model.BackupPlan do
  @moduledoc """
  A `BackupPlan` specifies some common fields, such as `description` as well as one or more `BackupRule` messages. Each `BackupRule` has a retention policy and defines a schedule by which the system is to perform backup workloads.

  ## Attributes

  *   `backupRules` (*type:* `list(GoogleApi.BackupDR.V1.Model.BackupRule.t)`, *default:* `nil`) - Required. The backup rules for this `BackupPlan`. There must be at least one `BackupRule` message.
  *   `backupVault` (*type:* `String.t`, *default:* `nil`) - Required. Resource name of backup vault which will be used as storage location for backups. Format: projects/{project}/locations/{location}/backupVaults/{backupvault}
  *   `backupVaultServiceAccount` (*type:* `String.t`, *default:* `nil`) - Output only. The Google Cloud Platform Service Account to be used by the BackupVault for taking backups. Specify the email address of the Backup Vault Service Account.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. When the `BackupPlan` was created.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. The description of the `BackupPlan` resource. The description allows for additional details about `BackupPlan` and its use cases to be provided. An example description is the following: "This is a backup plan that performs a daily backup at 6pm and retains data for 3 months". The description must be at most 2048 characters.
  *   `etag` (*type:* `String.t`, *default:* `nil`) - Optional. `etag` is returned from the service in the response. As a user of the service, you may provide an etag value in this field to prevent stale resources.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Optional. This collection of key/value pairs allows for custom labels to be supplied by the user. Example, {"tag": "Weekly"}.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Identifier. The resource name of the `BackupPlan`. Format: `projects/{project}/locations/{location}/backupPlans/{backup_plan}`
  *   `resourceType` (*type:* `String.t`, *default:* `nil`) - Required. The resource type to which the `BackupPlan` will be applied. Examples include, "compute.googleapis.com/Instance", "sqladmin.googleapis.com/Instance" and "storage.googleapis.com/Bucket".
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. The `State` for the `BackupPlan`.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. When the `BackupPlan` was last updated.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :backupRules => list(GoogleApi.BackupDR.V1.Model.BackupRule.t()) | nil,
          :backupVault => String.t() | nil,
          :backupVaultServiceAccount => String.t() | nil,
          :createTime => DateTime.t() | nil,
          :description => String.t() | nil,
          :etag => String.t() | nil,
          :labels => map() | nil,
          :name => String.t() | nil,
          :resourceType => String.t() | nil,
          :state => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:backupRules, as: GoogleApi.BackupDR.V1.Model.BackupRule, type: :list)
  field(:backupVault)
  field(:backupVaultServiceAccount)
  field(:createTime, as: DateTime)
  field(:description)
  field(:etag)
  field(:labels, type: :map)
  field(:name)
  field(:resourceType)
  field(:state)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.BackupDR.V1.Model.BackupPlan do
  def decode(value, options) do
    GoogleApi.BackupDR.V1.Model.BackupPlan.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.BackupDR.V1.Model.BackupPlan do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
